USE [iicdb]
GO

/****** Object:  View [dbo].[vReportExamSchedule]    Script Date: 12/09/2011 21:26:57 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vReportExamSchedule]'))
DROP VIEW [dbo].[vReportExamSchedule]
GO

USE [iicdb]
GO

/****** Object:  View [dbo].[vReportExamSchedule]    Script Date: 12/09/2011 21:26:57 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[vReportExamSchedule] AS

SELECT	RTRIM(Student.FirstName) + ' ' + RTRIM(Student.LastName) AS 'FullName', Student.IdNumber, Student.Address1 AS 'StudentAddress1', Student.Address2 AS 'StudentAddress2', Student.Address3 AS 'StudentAddress3', Student.Address4 AS 'StudentAddress4', 
		ClassMember.CandidateCode, ClassMember.Grade, 
		Period.PeriodId, Period.PeriodCode, Period.PeriodName, 
		Lesson.LessonId, Lesson.LessonCode, Lesson.LessonName, 
		ExamCenter.CenterName, ExamCenter.Address1, ExamCenter.Address2, ExamCenter.Address3,
		Class.ExamDate, Class.ExamTimeFrom, Class.ExamTimeTo
FROM         Student INNER JOIN
                      ClassMember ON Student.StudentId = ClassMember.StudentId LEFT OUTER JOIN
                      Class INNER JOIN
                      ExamCenter ON Class.ExamCenterID = ExamCenter.ExamCenterId INNER JOIN
                      Lesson ON Class.LessonId = Lesson.LessonId INNER JOIN
                      Period ON Class.PeriodId = Period.PeriodId ON ClassMember.ClassId = Class.ClassId
GO


